<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <title>title</title>
    <link rel="stylesheet" type="text/css" href="../../../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../../../css/style.css" />
    <link rel="stylesheet" type="text/css" href="../../../css/aui.css" />
    <link rel="stylesheet" type="text/css" href="../../../icon/iconfont.css" />
    <style>
        .topBg {
            height: 9rem;
        }
        .content {
            padding: 0.5rem .8rem;
        }
        header{
          padding: 1.6rem 0.8rem 0.8rem 0.8rem;
          overflow: hidden;
          line-height: 1rem
        }
        .left{
          float: left;
        }
        header .left span:nth-of-type(1){
          font-size: 1rem;
        }
        header .left span:nth-of-type(2){
          font-size: 1rem;
        }
        header .right{
          vertical-align: top;
          font-size: 1.3rem;
          float: right;
        }
        .fenxiang{
          position: fixed;
          padding: 0 0.5rem;
          right: 0.5rem;
          top: 3.5rem;
          width: 5.5rem;
          height: 2rem;
          background-color: rgb(211, 155, 81);
          border-radius: 5px;
          line-height: 2rem;
          display: flex;
          justify-content: space-around;
          display: none;
        }
        .fenxiang:after{
          content: '';
          position: absolute;
          right: 12px;
          top: -16px;
          width: 0;
          height: 0;
          border: 8px solid;
          border-top-radius: 5px;
          border-color: transparent transparent rgb(211, 155, 81);
        }
        .fenxiang span{
          color: #fff;
        }
        .fenxiang span:nth-of-type(1){
          font-size: 1rem
        }
        .yaoqing{
          width: 100%;
          height: 100%;
        }
        .content p{
          font-size: 0.8rem;
          color: #000;
        }
    </style>
</head>

<body>
  <div class="yaoqing">
    <header>
      <div class="left">
        <span class="iconfont icon-fanhui" onClick="api.closeWin()"></span>
        <span>邀请好友</span>
      </div>
      <span id="share_wx" onclick="share_WX();" class="iconfont icon-fenxiangdaozhuanfafasongzhiyuanquanxianxing right"></span>
    </header>
      <div class="max-box" id="content"></div>
      <img src="../../../image/banner.jpg" alt="">
      <!-- <div class="fenxiang">
        <span class="iconfont icon-zhuanfa"></span>
        <span id="share_wx" onclick="share_WX();">转发分享</span>
      </div>   -->
  </div>
</body>
<script type="text/javascript" src="../../../script/jquery-3.3.1.js"></script>
<script type="text/javascript" src="../../../script/api.js"></script>
<script type="text/javascript" src="../../../script/dns.js"></script>
<script type="text/javascript" src="../../../script/aui-toast.js"></script>
<script type="text/javascript" src="../../../lib/artTemplate/template.js"></script>
<script type="text/javascript">
    apiready = function() {
    };
    var toast = new auiToast({
        })
    $(".right").click(function(e) {
      e.stopPropagation()
      $(".fenxiang").css("display","block")
    })
    $(".yaoqing").click(function () {
      $(".fenxiang").fadeOut(100)
    })
    $(".fenxiang").click(function (e) {
      e.stopPropagation()
    });

    //分享
    function share_wx () {
      // 获取此时的毫秒数
      var newTime = new Date();
      var getnewTime = newTime.getTime();
      // 获取登陆时的毫秒数
      var getloginTime = localStorage.getItem("getloginTime");
      var Time = getnewTime-getloginTime;
      var token = localStorage.getItem("token");
      var cacheTime = localStorage.getItem("cacheTime");
      if(Time>cacheTime||!token){
        api.confirm({
            title: "当前游客状态",
            msg: "需要前往登录页面,是否继续?",
            buttons: ["是", "否"]
        }, function(ret, err) {
          if(ret.buttonIndex == 1){
            toast.loading({
                    title:"跳转中",
                    duration:2000
                },function(ret){
                    setTimeout(function(){
                        toast.hide();
                    }, 3000)
                });
            setTimeout(function () {
              api.openWin({
                  name: 'login',
                  url: '../../system/login.html',
                  allowEdit: true,
                  pageParam: {}, //页面代参数
                  rect: {
                      x: 0,
                      y: 0,
                      w: api.winWidth,
                      h: api.winHeight
                  }
              });
            },1000)
          }
        });
        return false;
      }
      var wx = api.require('wx');
        wx.isInstalled(function(ret, err) {
        if (ret.installed) {
          wx.shareImage({
              apiKey: 'wx99475b10511a3195',
              scene: 'timeline',
              thumb: './codenew3.png',
              contentUrl: './codenew.jpg'
              }, function(ret, err) {
                  if (ret.status==true) {
                    toast.success({
                        title:"分享成功",
                        duration:1500
                    });
                  } else {
                      toast.fail({
                          title:"取消分享!",
                          duration:1500
                      });
                  }
              });

          } else {
            toast.fail({
                title:"当前设备未安装微信客户端!",
                duration:1500
            });
          }
        });
      }
  function share_WX () {
    share_wx();
    return;
  }
</script>

</html>
